package com.ibeeking.found.common.enums.coupon;

/**
 * @Author ibeeking
 */

public enum CouponStatusEnum {

    /**
     *
     */
    AVAILABLE(0,"可用"),

    DISABLED(1,"不可用/已核销"),

    EXPIRED(2,"已过期"),

    LOCKED(3,"已锁定"),
    ;

    private Integer code;
    private String lable;

    CouponStatusEnum(Integer code,String lable) {
        this.code = code;
        this.lable = lable;
    }

    public String getName() {
        return lable;
    }

    public Integer getCode() {
        return code;
    }

    public static String getLableByCode(Integer code) {
        for (CouponStatusEnum enumObj : values()) {
            if (enumObj.getCode().equals(code)) {
                return enumObj.getName();
            }
        }
        return null;
    }

    public static CouponStatusEnum getEnumByCode(Integer code) {
        for (CouponStatusEnum enumObj : values()) {
            if (enumObj.getCode().equals(code)) {
                return enumObj;
            }
        }
        return null;
    }
}
